package bb.lanxing.manager;

import android.content.SharedPreferences;
import bb.lanxing.App;

public class PlaceCouponSharedPreference extends BaseSharedPreference implements ISharedPreference {
    private static final String KEY_BIKE_PLACE_DISCOUNT_TIME = "bike_place_discount_time";
    private static final String KEY_NEW_BIKE_PLACE_DISCOUNT = "new_bike_place_discount";
    private static PlaceCouponSharedPreference placeCouponSharedManager;

    @Override
    public void commit() {
        super.commit();
    }

    @Override
    public boolean contains(String str) {
        return super.contains(str);
    }

    @Override
    public boolean getBoolean(String str, boolean z) {
        return super.getBoolean(str, z);
    }

    @Override
    public Enum getEnum(String str, Enum r2) {
        return super.getEnum(str, r2);
    }

    @Override
    public float getFloat(String str, float f) {
        return super.getFloat(str, f);
    }

    @Override
    public int getInt(String str, int i) {
        return super.getInt(str, i);
    }

    @Override
    public long getLong(String str, long j) {
        return super.getLong(str, j);
    }

    @Override
    public String getString(String str, String str2) {
        return super.getString(str, str2);
    }

    @Override
    public void registerOnSharedPreferenceChangeListener(SharedPreferences.OnSharedPreferenceChangeListener onSharedPreferenceChangeListener) {
        super.registerOnSharedPreferenceChangeListener(onSharedPreferenceChangeListener);
    }

    @Override
    public void remove(String str) {
        super.remove(str);
    }

    @Override
    public void setValue(String str, Object obj) {
        super.setValue(str, obj);
    }

    @Override
    public void unregisterOnSharedPreferenceChangeListener(SharedPreferences.OnSharedPreferenceChangeListener onSharedPreferenceChangeListener) {
        super.unregisterOnSharedPreferenceChangeListener(onSharedPreferenceChangeListener);
    }

    private PlaceCouponSharedPreference() {
        super(App.getContext().getSharedPreferences("bike_place_sp", 0));
    }

    public static PlaceCouponSharedPreference getInstance() {
        if (placeCouponSharedManager == null) {
            synchronized (PlaceCouponSharedPreference.class) {
                if (placeCouponSharedManager == null) {
                    placeCouponSharedManager = new PlaceCouponSharedPreference();
                }
            }
        }
        return placeCouponSharedManager;
    }

    public boolean isShowNewPlaceCoupon(long j) {
        return getBoolean(buildBooleanKey(j), false);
    }

    public long getBikePlaceCouponTime(long j) {
        return getLong(buildLongKey(j), System.currentTimeMillis());
    }

    public void setShowNewPlaceCoupon(long j, boolean z) {
        setValue(buildBooleanKey(j), z);
    }

    public void setBikePlaceCouponTime(long j, long j2) {
        setValue(buildLongKey(j), j2);
    }

    private String buildLongKey(long j) {
        return String.valueOf(j) + "time";
    }

    private String buildBooleanKey(long j) {
        return String.valueOf(j) + "state";
    }

    public boolean userHaveBikePlace() {
        return getBoolean(String.valueOf(App.getContext().getUserId()), false);
    }

    public void setUserHaveBikePlace(boolean z) {
        setValue(String.valueOf(App.getContext().getUserId()), z);
    }

    public boolean isNewBikePlaceListDiscount() {
        return getBoolean(KEY_NEW_BIKE_PLACE_DISCOUNT, false);
    }

    public void setNewBikePlaceListDiscount(boolean z) {
        setValue(KEY_NEW_BIKE_PLACE_DISCOUNT, z);
    }

    public long getBikePlaceListDiscountTime() {
        return getLong(KEY_BIKE_PLACE_DISCOUNT_TIME, 0L);
    }

    public void setBikePlaceListDiscountTime(long j) {
        setValue(KEY_BIKE_PLACE_DISCOUNT_TIME, j);
    }
}
